﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using DotConferenceSql;
using NUnit.Framework.SyntaxHelpers;

namespace TestDotConferenceSql
{
    [TestFixture]
    public class TestOrderByQueryElement
    {
        SqlQuery query;

        [SetUp]
        public void Init()
        {
            query = new SqlQuery();
        }

        [Test]
        public void TestOrderByAsc()
        {
            query.Elements.Add(new OrderByQueryElement("field1", OrderByQueryElement.Order.Ascendant));

            Assert.That(query.BuildTextQuery(), Text.Contains("ORDER BY field1 ASC"));
        }

        [Test]
        public void TestOrderByDesc()
        {
            query.Elements.Add(new OrderByQueryElement("field1", OrderByQueryElement.Order.Descendant));

            Assert.That(query.BuildTextQuery(), Text.Contains("ORDER BY field1 DESC"));
        }
    }
}
